Hệ thống quản lý trường học bằng PHP / MySQLi

1
2   <?php
3   
//error_reporting(0);
4   include(
'connect.php');
5     
if (isset($_POST['register'])){
6  
7
8                 $staff_id=$_POST[
'staff_id'];
9                 $sirname = $_POST[
'sirname'];
10                 $firstname= $_POST[
'firstname'];
11                 $lastname = $_POST[
'lastname'];
12                 $idno = $_POST[
'idno'];
13                 $dateofbirth = $_POST[
'dateofbirth'];
14                 $gender = $_POST[
'gender'];
15                 
// $country_id = $_POST['country_id'];
16                 
// $county_id = $_POST['county_id'];
17                 
// $constituency_id = $_POST['constituency_id'];
18                 $mobile = $_POST[
'mobile'];
19                 $email = $_POST[
'email'];
20                 $address = $_POST[
'address'];
21                 $zipcode = $_POST[
'zipcode'];
22                 $doa = $_POST[
'doa'];
23                 $kra = $_POST[
'kra'];
24                 $nssf = $_POST[
'nssf'];
25                 $nhif = $_POST[
'nhif'];
26                 $roles = $_POST[
'roles'];
27                 $department_id = $_POST[
'department_id'];
28
29
30                 
//$sql2="UPDATE `staff` SET `sirname`='$sirname',`firstname`='$firstname',`lastname`='$lastname',`idno`='$idno',`dateofbirth`='$dateofbirth',`gender`='$gender',`country_id`='$country_id',`county_id`='$county_id',`constituency_id`='$constituency_id',`mobile`='$mobile',`email`='$email',`address`='$address',`zipcode`='$zipcode',`doa`='$doa',`kra`='$kra',`nssf`='$nssf',`nhif`='$nhif',`roles`='$roles',`department_id`='$department_id' WHERE `staff_id`=$staff_id";
31                 $sql2=
"UPDATE `staff` SET `sirname`='$sirname',`firstname`='$firstname',`lastname`='$lastname',`idno`='$idno',`dateofbirth`='$dateofbirth',`gender`='$gender',`mobile`='$mobile',`email`='$email',`address`='$address',`zipcode`='$zipcode',`doa`='$doa',`kra`='$kra',`nssf`='$nssf',`nhif`='$nhif',`roles`='$roles',`department_id`='$department_id' WHERE `staff_id`=$staff_id";
32                 
33                mysqli_query($db,$sql2);
34
35 ?>
36 <?php
37        
38                         $query=
"SELECT * FROM staff WHERE staff_id='$staff_id'";
39                         $records2=mysqli_query($db,$query);
40                         
while($rec=mysqli_fetch_array($records2))
41                         {
42                         $id = $rec[
'staff_id'];
43                         }?>
44                         
45                         <script>
46                         alert(
'Record Succsessfully Updated');
47                         window.location =
"viewstaff.php?id=<?php echo $id;?>";
48                         </script>
49
50 <?php
51
52 }?>


Gõ tìm kiếm nhanh...